<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>
			兄弟海鲜管理系统
		</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0">
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="./css/x-admin.css" media="all">
		<script src="js/jquery.min.js"></script>
		<link href="css/xtiper.css" type="text/css" rel="stylesheet" />
		<script src="js/xtiper.min.js" type="text/javascript"></script>

	</head>

	<body style="background-color: #393D49">
		<div class="x-box">
			<div class="x-top">
				<i class="layui-icon x-login-close">
                  <!--
                  	作者：1005914681@qq.com
                  	时间：2020-01-06
                  	描述：海产品管理系统标题，可以弄个图片
                  -->
                </i>
			</div>
			<div class="x-mid">
				<div style="font-size: 30px;margin-left: 50px;">
					兄弟海鲜系统管理后台
				</div>
				<div class="input">
					<div style="margin-top: 40px;">
						<div class="layui-form-item x-login-box">
							<label for="username" class="layui-form-label">
                                <i class="layui-icon">&#xe612;</i>
                            </label>
							<div class="layui-input-inline">
								<input type="text" id="username" name="username" autocomplete="off" placeholder="账号" class="layui-input" style="width: 300px;">
							</div>
						</div>
						<div class="layui-form-item x-login-box">
							<label for="pass" class="layui-form-label">
                                <i class="layui-icon">&#xe628;</i>
                            </label>
							<div class="layui-input-inline">
								<input type="password" id="password" name="password" autocomplete="off" placeholder="密码" class="layui-input" style="width: 300px;">
							</div>
						</div>
						<div class="layui-form-item" id="loginbtn" onclick="getenter()">
							<button class="layui-btn">
                                登 录
                            </button>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="./lib/layui/layui.js" charset="utf-8">
		</script>
		<script type="text/javascript">
			function getenter() {
				var url = 'http://127.0.0.1:8080/user/login';
				var username = $("#username").val()
				var password = $("#password").val();
				if(username == "") {
					xtip.msg("账号不能为空！");
				} else if(password == "") {
					xtip.msg("密码不能为空！");
				} else {
					var settings = {
						"url": "http://127.0.0.1:8080/user/login",
						"method": "POST",
						"timeout": 0,
						"headers": {
							"Content-Type": "application/json"
						},
						"data": JSON.stringify({
							"userEntername": username,
							"userPwd": password
						}),
					};

					$.ajax(settings).done(function(response) {
						xtip.msg('登录成功');
						if(response.userId=='1') {
							setTimeout(function() {
								location.href = "./index.html";
								localStorage.setItem("name", response.userName);
							}, 1000);
						} else {
							setTimeout(function() {
								location.href = "./index2.html";
								localStorage.setItem("name", response.userName);
							}, 1000);
						}

					});
				}
			}
		</script>
	</body>

</html>